﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery基础</title>
<script type="text/javascript" src="jquery-3.5.1.min.js"></script>
</head>
<body>

<h1>更换网页背景</h1>
<select name="" id="color">
    <option value="">请选择背景颜色</option>
    <option value="red">红色</option>
    <option value="green">绿色</option>
    <option value="blue">蓝色</option>
</select>
<input type="button"  value="更换背景" />

<script>
    $(document).ready(function() {
        $(`input[type='button']`).click(function() {
            let bgcolor=$(`#color`).val();
            document.bgColor=bgcolor;
        });
    })
    </script>
    
</body>
</html>